package com.singzi.leetcode.N1800;

import java.util.HashSet;

public class T1748 {
}
class Solution1748 {
    public int sumOfUnique(int[] nums) {

        HashSet<Integer> hashSet = new HashSet();
        HashSet<Integer> checkSet = new HashSet<>();
        for(Integer num:nums){
            if(checkSet.contains(num)) continue;
            if(hashSet.contains(num)){
                hashSet.remove(num);
                checkSet.add(num);
            }
            else hashSet.add(num);
        }
        int sum = 0;
        for(Integer num:hashSet){
            sum += num;
        }
        return sum;
    }
}